<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3-innerText和innerHTML</title>
</head>
<body>
    <div class="box"></div>

    <script>
        // innerText
        const box = document.querySelector('.box')
        box.innerText = '我很开心' // 如果 标签里没有内容 则添加
        console.log(box.innerText)
        

        box.innerText ='你开心吗？' // 如果标签里有内容 则修改
        console.log(box.innerText)

        box.innerText = '<p style="color:red;font-size:80px;">宫瑞会跳舞</p>'

        // innerHTML
        // box.innerHTML = '<p style="color:pink;font-size:50px;">宫瑞想跳舞</p>'

    </script>
</body>
</html>